import { View, Flex, Text } from '@aws-amplify/ui-react'; import { Example, ExampleCode } from '@/components/Example'; import { UseBreakpointValueArrayExample, UseBreakpointValueObjectExample, } from './examples'; ## Example Import any of our primitives and use either the object or array syntax to changes styles responsively. Resize your browser window window to see the styles change. ```jsx import { Flex, View } from '@aws-amplify/ui-react'; import '@aws-amplify/ui-react/styles.css'; Hello there! ; ``` Hello there! ## Object Syntax When using the object syntax, you can specify a style for multiple viewpoint ranges. The example below shows setting a style of `orange` from `base` (0em) through `small`, and `yellow` from `medium` (48em) upwards. ```jsx // View will be orange from 0 to 47em, then change to yellow from 48em upwards. ``` Or you can use the object syntax to specify styling for each breakpoint individually ```jsx // View background color and text color will change at each breakpoint Hello ``` Hello ## Array syntax When using the array syntax, specify each breakpoint styling in order from `base` up to `xxl`. If only a few styles are specified, all the breakpoints above will have the same style. ```jsx {' 🐈 '} {' 🐕 '} ``` {' 🐈 '} {' 🐕 '} ## useBreakpointValue A responsive design can be achieved for all properties using the `useBreakpointValue` hook. The hook will accept the object or array syntax and return the value of the current breakpoint. ```jsx file=./examples/UseBreakpointValueObjectExample.tsx ``` ```jsx file=./examples/UseBreakpointValueArrayExample.tsx ```